jevstrudel.git / website / src / pages / songs / [theme] / [song].astro
[song].astro18 lines · 524 B · raw
1---
2// One page per song, /songs/<theme>/<song>/: the REPL opened on that song,
3// with its own link preview.
4import ReplPage from '../../../jev/ReplPage.astro';
5import { loadSongs } from '../../../jev/songs.mjs';
6
7export async function getStaticPaths() {
8  const songs = (await loadSongs()).filter((s) => s.code);
9  return songs.map((song) => {
10    const [theme, name] = song.id.split('/');
11    return { params: { theme, song: name }, props: { song } };
12  });
13}
14
15const { song } = Astro.props;
16---
17
18<ReplPage song={song} />